import 'dart:convert';
import 'dart:developer';
import 'dart:io';

import 'package:device_info/device_info.dart';
import 'package:flutter/material.dart';
import 'package:flutter_demo/router/router.dart';
import 'package:permission_handler/permission_handler.dart';
import '../../Tabs.dart';

class LoginWay extends StatelessWidget {
  LoginWay();
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return Material(
      child: Container(
        decoration: BoxDecoration(color: Color.fromRGBO(26, 26, 26, 1)),
        child: Stack(
          alignment: Alignment.center,
          children: [
            Positioned(
                top: 134,
                child: Text(
                  '欢迎来到Ciao！你好',
                  style: TextStyle(fontSize: 24, color: Colors.white),
                )),
            Positioned(
                top: 272,
                child: Column(
                  children: [
                    InkWell(
                      onTap: () {
                        Navigator.of(context).pushAndRemoveUntil(
                            new MaterialPageRoute(
                                builder: (context) => new Tabs(2)),
                            (route) => route == null);
                      },
                      child: Image.asset(
                        'images/wx.png',
                        height: 40,
                        width: 229,
                      ),
                    ),
                    SizedBox(
                      height: 12,
                    ),
                    FlatButton(
                        onPressed: () async {
                          DeviceInfoPlugin deviceInfo = new DeviceInfoPlugin();
                          if (Platform.isIOS) {
                            IosDeviceInfo iosDeviceInfo =
                                await deviceInfo.iosInfo;
                          } else if (Platform.isAndroid) {
                            AndroidDeviceInfo androidDeviceInfo =
                                await deviceInfo.androidInfo;
                            print(
                                'tags: ${androidDeviceInfo.isPhysicalDevice}');
                          }
                          // RouterConfig.navigater(context, path: '/phoneLogin');
                        },
                        child: Image.asset(
                          'images/phone.png',
                          height: 40,
                          width: 229,
                        )),
                    SizedBox(
                      height: 12,
                    ),
                    FlatButton(
                        onPressed: () {
                          // Navigator.replace(context, '/Index', {title: '首页'});
                        },
                        child: Image.asset(
                          'images/apple.png',
                          height: 40,
                          width: 229,
                        )),
                    SizedBox(
                      height: 12,
                    ),
                    Container(
                      child: Text(
                        '未注册账号登录后自动注册',
                        style: TextStyle(
                            color: Color.fromRGBO(105, 105, 105, 1),
                            fontSize: 12),
                      ),
                    )
                  ],
                )),
            Positioned(
                bottom: 22,
                child: Container(
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: [
                      InkWell(
                          onTap: () {
                            print('123123');
                          },
                          child: Image.asset(
                            'images/1.png',
                            width: 22,
                            height: 22,
                          )),
                      SizedBox(
                        width: 12,
                      ),
                      Column(
                        children: [
                          Row(
                            children: [
                              Text(
                                '同意',
                                style: TextStyle(
                                    color: Color.fromRGBO(105, 105, 105, 1),
                                    fontSize: 12),
                              ),
                              InkWell(
                                child: Text(
                                  '用户协议',
                                  style: TextStyle(
                                      color: Color(0xFF5538AE), fontSize: 12),
                                ),
                              ),
                              Text(
                                '和',
                                style: TextStyle(
                                    color: Color.fromRGBO(105, 105, 105, 1),
                                    fontSize: 12),
                              ),
                              InkWell(
                                child: Text(
                                  '隐私政策',
                                  style: TextStyle(
                                      color: Color(0xFF5538AE), fontSize: 12),
                                ),
                              ),
                            ],
                          ),
                          Row(
                            children: [
                              Text(
                                '并',
                                style: TextStyle(
                                    color: Color.fromRGBO(105, 105, 105, 1),
                                    fontSize: 12),
                              ),
                              InkWell(
                                child: Text(
                                  '承诺您已满18岁',
                                  style: TextStyle(
                                      color: Color(0xFFD63157), fontSize: 12),
                                ),
                              ),
                            ],
                          )
                        ],
                      ),
                    ],
                  ),
                ))
          ],
        ),
      ),
    );
  }
}
